feat: TLS support in switchyard-server#53
Conversation
Usage: ``` switchyard-server --tls-cert cert.pem --tls-key key.pem ..other_args ``` The startup output then shows `https://` URLs. Generate self-signed certs for dev: ``` openssl genpkey -algorithm Ed25519 -out key.pem openssl req -new -x509 -key key.pem -days 1460 -out cert.pem -subj "/C=US/ST=CA/L=Santa Clara/O=LocalDev/OU=Switchyard/CN=example.com" ``` Rust only. Signed-off-by: Graham King <grahamk@nvidia.com>
WalkthroughThe server now accepts optional TLS certificate and key paths, validates them through the CLI, serves HTTPS with rustls when configured, and updates Python bindings and startup URLs to represent TLS mode. ChangesTLS server support
Estimated code review effort: 4 (Complex) | ~45 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/switchyard-server/src/cli.rs`:
- Around line 59-78: Add a concise Rust doc comment to the into_options method
describing that it builds ServerRunOptions, validates TLS certificate and key
paths, and returns InvalidConfig when either configured path does not exist.
In `@crates/switchyard-server/src/lib.rs`:
- Around line 148-174: Add a concise Rust doc comment immediately above the
public `serve_tls` function, describing that it serves the router over TLS and
performs graceful shutdown after receiving the shutdown signal. Keep the
documentation focused on the function’s purpose and externally observable
behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 1f5723d9-7a53-44c8-a62e-b22f05a40daa
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock,!Cargo.lock
📒 Files selected for processing (4)
crates/switchyard-py/src/server_bindings.rscrates/switchyard-server/Cargo.tomlcrates/switchyard-server/src/cli.rscrates/switchyard-server/src/lib.rs
Thanks CodeRabbit. Signed-off-by: Graham King <grahamk@nvidia.com>
Usage:
The startup output then shows
https://URLs.Generate self-signed certs for dev:
Rust only.
Summary by CodeRabbit